#!/bin/bash
SQL_SONAR_FILE="scriptDB.sql"
lineSeparator=`grep -n "#### $SQL_SONAR_FILE ####" $0|grep -v "grep" |sed s:"\:#### $SQL_SONAR_FILE ####":"":g`
sed 1,${lineSeparator}d $0 > $SQL_SONAR_FILE
/usr/bin/mysql --user=root -p <$SQL_SONAR_FILE
rm -Rf $SQL_SONAR_FILE
exit 0



#### scriptDB.sql ####
DROP DATABASE IF EXISTS blog;
CREATE DATABASE blog;
GRANT ALL PRIVILEGES ON blog.* TO "blog"@`hostname` IDENTIFIED BY "softwaresano";
GRANT ALL PRIVILEGES ON blog.* TO "blog"@localhost IDENTIFIED BY "softwaresano";
FLUSH PRIVILEGES;
commit;
EXIT 
